import requet from "../utils/requet.js";
import axios from "axios";
/* 全局初始化 */
export function init(params) {
  return requet({
    url: "/common/config-init",
    method: "GET",
    params
  });
}
/* 注册 */
export function userRegister(data) {
  return requet({
    url: "/user/register",
    method: "POST",
    data
  });
}
/* 图形验证码展示 */
export function getCaptcha(params) {
  return requet({
    url: "/common/captcha-view",
    GET: "GET",
    params
  });
}
/* 图形验证码校验 */
export function checkCaptcha(params) {
  return requet({
    url: "/common/captcha-check",
    method: "GET",
    params
  });
}
/* 登录 */
export function userLogin(data) {
  return requet({
    url: "/user/login",
    method: "POST",
    data
  });
}
/* 退出 */
export function userLogout(data) {
  return requet({
    url: "/user/logout",
    method: "POST",
    data
  });
}
/* 当前登录用户信息查询 */
export function userDetail(params) {
  return requet({
    url: "/user/detail",
    method: "GET",
    params
  });
}
/* 当前登录用户密码修改 */
export function userEditPsw(data) {
  return requet({
    url: "/user/password-modify",
    method: "POST",
    data
  });
}
/* 获取指定场景授权凭证 */
export function getTicket(data) {
  return requet({
    url: "/user/get-ticket",
    method: "POST",
    data
  });
}

/* vip详情 */
export function userVip(params) {
  return requet({
    url: "/user/vip-info",
    method: "GET",
    params
  });
}

/* 获取邀请code */
export function agentCode(params) {
  return requet({
    url: "/agent/code",
    method: "GET",
    params
  });
}

/* 获取邀请code */
export function getAgentUserData(params) {
  return requet({
    url: "/agent/user",
    method: "GET",
    params
  });
}

/* 用户是否存在校验 */
export function getUserExists(params) {
  return requet({
    url: "/user/exists",
    method: "GET",
    params
  });
}

/* 用户邮箱验证是否存在校验 */
export function postUserEmial(params) {
  return requet({
    url: "/user/email-check",
    method: "POST",
    params
  });
}

/* 用户邮箱发送验证码 */
export function postUserEmiaSendl(params) {
  return requet({
    url: "/user/email-send",
    method: "POST",
    params
  });
}

/* 用户忘记密码 */
export function postUserForgoPassword(params) {
  return requet({
    url: "/user/forgot-password",
    method: "POST",
    params
  });
}

/* 用户忘记密码 */
export function postUserEmailModify(params) {
  return requet({
    url: "/user/email-modify",
    method: "POST",
    params
  });
}

/* 用户忘记密码 */
export function getUserEmailCode(params) {
  return requet({
    url: "/user/email-code",
    method: "GET",
    params
  });
}

/* 发送短信验证码 */
export function postUserPhoneSend(params) {
  return requet({
    url: "/user/phone-send",
    method: "POST",
    params
  });
}

/* 用户手机号验证 */
export function postUserPhoneCheckGetCode(params) {
  return requet({
    url: "/user/phone-check",
    method: "POST",
    params
  });
}

/* 用户修改手机号 */
export function postUserPhoneModify(params) {
  return requet({
    url: "/user/phone-modify",
    method: "POST",
    params
  });
}

/* 短信验证码校验 */
export function postUserSmsCodeCheck(params) {
  return requet({
    url: "/user/sms-code-check",
    method: "POST",
    params
  });
}

/* 通用接口-短信注册开关 */
export function getCommonRegisterConfig(params) {
  return requet({
    
    url: "/common/register-config",
    method: "GET",
    params
  });
}

/* 修改用户电话 */
export function postAddUserPhone(params) {
  return requet({
    url: "/user/phone-add",
    method: "POST",
    params
  });
}

/** 游客登录 */
export const touristLogin = params => {
  return requet({
    url: "/guest/login",
    method: "POST",
    params
  });
};

/** 获取谷歌登录 */
export const getGoogleCode = async params => {
  return requet({
    url: "/google/login",
    method: "GET",
    params
  });
};
